﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace GalaxyPresident
{
    public class AttackingHelper : GameBase.InvisibleGameEntity
    {
        private PlanetObjectOwner _targetAttack;
        private Ammo _ammo;
        private bool _isAutoChase = true;

        public Ammo Ammo
        {
            get { return _ammo; }
            set { _ammo = value; }
        }

        public PlanetObjectOwner TargetAttack
        {
            get { return _targetAttack; }
            set { _targetAttack = value; }
        }

        public bool IsAutoChase
        {
            get { return _isAutoChase; }
            set { _isAutoChase = value; }
        }

        public AttackingHelper(Ammo ammo)
        {
            _ammo = ammo;
        }

        public void attackTo(PlanetObjectOwner obj)
        {
            TargetAttack = obj;
        }

        public void attackProcessing(Vector2 beginPos)
        {
            if (TargetAttack == null)
                return;

            Ammo ammo = this.Ammo.clone();
            ammo.fireTarget(beginPos, TargetAttack, IsAutoChase);
            ammo.Scale = _targetAttack.Scale;
        }
    }
}
